<template>
  <div class="content">
    <div class="content__left" v-show="isHidden">
      <left-tree />
    </div>
    <div class="content__empt" v-show="!isHidden">
      <left-empt />
    </div>
    <div class="content__right">
      <right-table />
    </div>
  </div>
</template>

<script lang="ts" setup>
import { provide, ref, watch } from "vue";
import { injectKeyCompany } from "./components/context";
import LeftTree from "./components/LeftTree.vue";
import LeftEmpt from "./components/LeftEmpt.vue";
import RightTable from "./components/RightTable.vue";
import { useUserStoreHook } from "/@/store/modules/user";

let active: any = ref({});
let isHidden = ref<boolean>(true);
const userHook = useUserStoreHook();
// 监听右侧数据变化
watch(
  () => userHook.isHidden,
  newVal => {
    isHidden.value = newVal;
  }
);
provide(injectKeyCompany, active);
</script>

<style lang="scss" scoped>
.content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: calc(100vh - 120px);
  width: 100%;
  &__left {
    height: inherit;
    width: 300px;
    margin-right: 5px;
  }
  &__empt {
    height: inherit;
    width: 30px;
    margin-right: 5px;
  }
  &__right {
    height: inherit;
    flex: 1;
    background: #fff;
    overflow-x: auto;
  }
}
</style>
